<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let socket = new WebSocket("wss://sports.dawnbyte.com/soccer-stream/ws");

    socket.onopen = function(e) {
       /* alert("[open] Connection established");
        alert("Sending to server");
        socket.send("My name is John");*/
    };

    socket.onmessage = function(event) {
        // lert(`[message] Data received from server: ${event.data}`);
        console.log(event)
    };

    socket.onclose = function(event) {
        console.log(event)
       /* if (event.wasClean) {
            alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
        } else {
            // 例如服务器进程被杀死或网络中断
            // 在这种情况下，event.code 通常为 1006
            alert('[close] Connection died');
        }*/
    };

    socket.onerror = function(error,data) {
       // alert(`[error] ${error.message}`);
        console.log(error)
        console.log(data)
    };
</script>
</body>
</html>